{template 'common/header-gw'}
<script>
require(['jquery', 'util'], function($, u){
	$('#form1').submit(function(){
		if($.trim($(':text[name="username"]').val()) == '') {
			u.message('没有输入用户名.', '', 'error');
			return false;
		}
		if($('#password').val() == '') {
			u.message('没有输入密码.', '', 'error');
			return false;
		}
		if($('#password').val() != $('#repassword').val()) {
			u.message('两次输入的密码不一致.', '', 'error');
			return false;
		}
		{loop $extendfields $item}
		{if $item['required']}
			if (!$.trim($('[name="{$item['field']}"]').val())) {
				u.message('{$item['title']}为必填项，请返回修改！', '', 'error');
				return false;
			}
		{/if}
		{/loop}
		{if $setting['register']['code']}
		if($.trim($(':text[name="code"]').val()) == '') {
			u.message('没有输入验证码.', '', 'error');
			return false;
		}
		{/if}
	});
});
</script>
	<ol class="breadcrumb">
		<li><a href="./?refresh"><i class="fa fa-home"></i></a></li>
		<li class="active">注册</li>
	</ol>
	<div class="clearfix" style="margin-bottom:5em;">
		<div class="col-xs-12 col-sm-7 col-md-8 col-lg-9" style="padding-left:0;">
			<div class="jumbotron">
				<h2>欢迎使用微擎系统</h2>
			</div>
		</div>
		<div class="panel panel-default col-xs-12 col-sm-5 col-md-4 col-lg-3" style="padding-right:0;">
			<div class="panel-body">
				<form action="" method="post" role="form" id="form1">
					<div class="form-group">
						<label>用户名:<span style="color:red">*</span></label>
						<input name="username" type="text" class="form-control" placeholder="请输入用户名">
					</div>
					<div class="form-group">
						<label>密码:<span style="color:red">*</span></label>
						<input name="password" type="password" id="password" class="form-control" placeholder="请输入密码">
					</div>
					<div class="form-group">
						<label>确认密码:<span style="color:red">*</span></label>
						<input name="password" type="password" id="repassword" class="form-control" placeholder="请再次输入密码">
					</div>
					{if $extendfields}
						{loop $extendfields $item}
						<div class="form-group">
							<label>{$item['title']}：{if $item['required']}<span style="color:red">*</span>{/if}</label>
							{php echo tpl_fans_form($item['field'])}
						</div>
						{/loop}
					{/if}
					{if $setting['register']['code']}
					<div class="form-group">
						<label style="display:block;">验证码:<span style="color:red;">*</span></label>
						<input name="code" type="text" class="form-control" placeholder="请输入验证码" style="width:65%;display:inline;margin-right:17px">
						<img src="{php echo url('member/code');}" class="img-rounded" style="cursor:pointer;" onclick="this.src='{php echo url('member/code');}' + Math.random();" />
					</div>
					{/if}
					<div class="form-group">
						<label>邀请码:<span style="color:red">*</span></label>
						<input name="invitation" type="text" class="form-control" placeholder="请输入邀请码">
					</div>
					<div class="pull-right">
						<a href="{url 'user/login'}" class="btn btn-link">登陆</a>
						<input type="submit" name="submit" value="注册" class="btn btn-default" />
						<input name="token" value="{$_W['token']}" type="hidden" />
					</div>
				</form>
			</div>
		</div>
	</div>
</form>
{template 'common/footer-gw'}
